package spring.config;

import javax.annotation.Resource;
import javax.sql.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@Configuration	
public class UploadFileConfig {
	@Resource(name="dataSource")
	public DataSource dataSource;
	
	@Bean(name="multipartResolver")
	public CommonsMultipartResolver multipartResolver(){
		CommonsMultipartResolver cmr=new CommonsMultipartResolver();
		return cmr;
	}
	
	@Bean(name="imageSequence")
	public OracleSequenceMaxValueIncrementer getImageSequence(){
		OracleSequenceMaxValueIncrementer osmi=new OracleSequenceMaxValueIncrementer();
		osmi.setIncrementerName("image_id");
		osmi.setDataSource(dataSource);
		return osmi;
	}
}
